<template>

    <div class="about">
        <div class="site-content">
            <div class="content-warp">
<!--                <div class="about-site about-info">-->
<!--                    <section-title><span>❤</span>关于博客</section-title>-->
<!--                    <div class="">-->
<!--                    </div>-->
<!--                </div>-->
                
                <!--简历结束-->
                <div class="about-me about-info">
                    <section-title id="Guestbook"><span>❤</span>给我留言</section-title>
                    <div class="info-card">
                        <div class="contactForm">
                            <div class="form-item">
                                <label for="mail">邮箱</label>
                                <input v-model="about.email" class="v" type="email" name="mail" id="mail">
                            </div>
                            <div class="form-item">
                                <label for="content">内容</label>
                                <textarea class="v" id="content" name="content" v-model="about.content"
                                          style="height: 150px"></textarea>
                            </div>
                            <div class="form-item">
                                <label></label>
                                <button @click="aboutMe()">提交</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>

    import sectionTitle from '@/components/section-title'
    import {getTime, getTimeInterval} from '@/utils'
    // import Quote from "@/components/quote";
    import {aboutMe, resume} from '../api'

    export default {
        name: "About",
        data() {
            return {
                about: {},
                list: [],
                resume:""
            }
        },
        created() {
            // this.getResume()
        },
        components: {
            // Quote,
            sectionTitle
        },
        methods: {
            //获取简历
            getResume(){
                resume().then(res => {
                    this.resume = res.data.resume.resume
                    console.log(this.resume)
                }).catch(err => {

                })
            },
            aboutMe() {
                this.check()
            },
            check() {
                const reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$"); //正则表达式
                const obj = document.getElementById("mail"); //要验证的对象
                if (obj.value === "") { //输入不能为空
                    this.$message({
                        type: 'warning',
                        message: '邮箱不能为空!'
                    })
                    return false;
                } else if (!reg.test(obj.value)) { //正则验证不通过，格式不对
                    this.$message({
                        type: 'error',
                        message: '请输入正确的邮箱格式!'
                    })
                    return false;
                } else {
                    aboutMe(this.about).then(res => {
                        this.$message({
                            type: 'success',
                            message: res.data.data
                        })
                        this.$router.push({path: "/"});
                    }).catch(err => {
                        this.$message({
                            type: 'error',
                            message: err.data.data
                        })
                    })
                }
            }
        },
        mounted() {
        }
    }
</script>
<style scoped lang="less">
    .container {
        width: 780px;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
        /* margin: 0 auto; */
    }
    .about {
        padding-top: 40px;
    }

    .content-warp {
        margin-top: 80px;

        .about-info {
            margin: 30px 0;

            span {
                color: red;
                margin-right: 10px;
            }

            .info-card {
                min-height: 100px;
                padding: 20px;
                border-radius: 3px;
                margin: 30px 0 50px 0;
                box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);

                p {
                    line-height: 1.7rem;
                }
            }
        }

        .contactForm {
            width: 100%;
            padding: 20px;

            .form-item {
                align-items: center;
                display: flex;

                &:not(:last-child) {
                    margin-bottom: 20px;
                }

                label {
                    width: 80px;
                }

                .v {
                    min-height: 40px;
                    line-height: 20px;
                    border-radius: 3px;
                    padding: 2px 10px;
                    outline: none;
                    border: 1px solid #8fd0cc;
                    width: 100%;
                    resize: vertical;
                }

                button {
                    width: 100px;
                    height: 40px;
                    border-radius: 3px;
                    outline: 0;
                    border-style: none;
                    cursor: pointer;
                    background-color: #409eff;
                    color: white;

                    &:hover {
                        opacity: 0.8;
                    }
                }
            }
        }
    }

    /*******/
    @media (max-width: 800px) {
        .content-warp {
            margin-top: 0;
        }
    }

    /*********/
    /*body {*/
    /*    background: #f4f4f4;*/
    /*    color: #757575;*/
    /*    font-family: 'Alegreya Sans', sans-serif;*/
    /*    letter-spacing: 2px;*/
    /*    padding-bottom: 60px;*/
    /*}*/

    .container {
        background: #fff;
        padding: 70px 75px;
        margin: 50px auto;
        /*border: 1px solid #ff0101;*/
    }

    img {
        max-width: 100%
    }

    .propic {
        border-radius: 10px;
    }

    hr {
        margin: 40px 0;
    }

    h1 {
        font-size: 2em;
        font-weight: bolder;
        text-transform: uppercase;
        color: #000;
        margin: 0;
    }

    h2 {
        font-size: 1.3em;
        background: #fcfcfc;
        padding: 10px;
    }

    h3 {
        font-size: 1.4em;
        text-transform: uppercase;
        color: #000;
        margin-top: 0;
    }

    h4 {
        margin: 15px 0 0;
    }
    h5 {
        /*font-size: 1.3em;*/
        background: #fcfcfc;
        /*padding: 10px;*/
    }
    p,
    a {
        line-height: 1.7em;
        font-weight: lighter;
        letter-spacing: 1px;
        font-size: 16px;
    }

    li {
        padding: 7px 0;
    }

    .dl-share .btn {
        min-width: 120px;
    }

    .signature {
        font-family: 'Kristi', cursive;
        color: #3e3f40;
        font-size: 2.2em;
        margin-top: 20px;
    }

    .social {
        margin-right: 7px;
    }

    .btn .fa {
        margin-right: 10px;
    }

    .secicon.fa {
        font-size: 28px;
        color: #000;
        margin-right: 10px;
    }

    .sub {
        margin-top: 5px;
        font-size: 15px;
        margin-bottom: 15px;
    }

    .award {
        padding-top: 20px;
    }

    blockquote {
        font-size: 1em;
        padding: 0 15px;
        margin: 30px 0;
    }

    .mainleft {
        padding-right: 30px;
    }

    .testimonials img {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        float: left;
        margin-right: 15px;
        margin-top: -10px;
        border: 1px solid #ededed;
    }

    .year,
    .share {
        text-align: right;
    }

    footer p,
    footer a {
        font-size: 13px;
    }

</style>
